﻿using Abp.Application.Services;
using Abp.AspNetCore.Mvc.Authorization;
using AbpZeroTemplate.Authorization;
using AbpZeroTemplate.Dto;
using AbpZeroTemplate.Logging;
using AbpZeroTemplate.Logging.Dto;
using AbpZeroTemplate.Web.Controllers;
using AbpZeroTemplate.Web.Swagger;
using Microsoft.AspNetCore.Mvc;

namespace AbpZeroTemplate.Api.Admin.Controllers
{
    /// <summary>日志
    /// </summary>
    [Area("Admin")]
    [Route("Admin/WebLog/[action]")]
    [ApiName("Admin")]
    [RemoteService]
    [AbpMvcAuthorize(AppPermissions.Pages_Administration_Host_Maintenance)]
    public class WebLogController : AbpZeroTemplateControllerBase
    {
        private readonly IWebLogAppService _webLogAppService;
        /// <summary>ctor
        /// </summary>
        public WebLogController(IWebLogAppService webLogAppService)
        {
            _webLogAppService = webLogAppService;
        }

        /// <summary>获取最新日志
        /// </summary>
        [HttpGet]
        public GetLatestWebLogsOutput GetLatestWebLogs()
        {
            return _webLogAppService.GetLatestWebLogs();
        }

        /// <summary>下载日志
        /// </summary>
        [HttpPost]
        public FileDto DownloadWebLogs()
        {
            return _webLogAppService.DownloadWebLogs();
        }


    }
}
